﻿/*
Post-Deployment Script Template							
--------------------------------------------------------------------------------------
 This file contains SQL statements that will be appended to the build script.		
 Use SQLCMD syntax to include a file in the post-deployment script.			
 Example:      :r .\myfile.sql								
 Use SQLCMD syntax to reference a variable in the post-deployment script.		
 Example:      :setvar TableName MyTable							
               SELECT * FROM [$(TableName)]					
--------------------------------------------------------------------------------------
*/


----------------------------------------------------------------------------------------
--                                     ACCOUNT TYPES
----------------------------------------------------------------------------------------

IF NOT EXISTS (SELECT * FROM AccountType WHERE AccountType.Name = N'BankAccount')
BEGIN
	INSERT INTO AccountType (Name) VALUES (N'BankAccount')
END

IF NOT EXISTS (SELECT * FROM AccountType WHERE AccountType.Name = N'CreditCard')
BEGIN
	INSERT INTO AccountType (Name) VALUES (N'CreditCard')
END

IF NOT EXISTS (SELECT * FROM AccountType WHERE AccountType.Name = N'Person')
BEGIN
	INSERT INTO AccountType (Name) VALUES (N'Person')
END

IF NOT EXISTS (SELECT * FROM AccountType WHERE AccountType.Name = N'Online Account')
BEGIN
	INSERT INTO AccountType (Name) VALUES (N'Online Account')
END

IF NOT EXISTS (SELECT * FROM AccountType WHERE AccountType.Name = N'Other') 
BEGIN
	INSERT INTO AccountType (Name) VALUES (N'Other')
END


IF NOT EXISTS (SELECT * FROM [User] WHERE [User].Id = 0) 
BEGIN
	INSERT INTO [User] ([Id] ,Name, [Password]) VALUES (0, N'admin', N'admin')
END